<template>
	<div class="wapper" ref="wapper">
		<div class="content"><slot></slot></div>
	</div>
</template>

<script>
	import Bscroll from "better-scroll"
	
	export default {
		name:"Scroll",
		props:{
			probeType:{
				type:Number,
				default:0
			},
			pullupLoad:{
				type:Boolean,
				default:false
			}
		},
		data(){
			return{
				scroll:null
			}
		},
		mounted(){
			console.log(this.$refs)
			this.scroll = new Bscroll(this.$refs.wapper,{
				click:true,
				probeType:this.probeType,
				pullUpLoad:this.pullupLoad
			})	
			// 2.监听滚动的位置
			this.scroll.on('scroll', (position) => {
					this.$emit('scroll', position)
			 })

			 // 3.监听上拉事件
			 this.scroll.on('pullingUp', () => {
					 this.$emit('pullingUp')
			})			
		}
	}
</script>

<style>
	.wapper{
		position: fixed;
		top:40px;
		bottom:44px;
		left:0px;
		right:0px;
	}
</style>
